/*
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 *
 * Copyright @2008 the original author or authors.
 */
package com.bluestone.report;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;

/**
 * This is a utility class that can be used by beans that support bound
 * properties.
 * @author <a href="mailto:ming7655@gmail.com">Aaron</a>
 */
public abstract class PropertyAwareObject implements Serializable {
	public static String PROPERTY_EXECUTERESULT = "executeResult";
	public static String PROPERTY_EXP="expProperties";
	private static final long serialVersionUID = -2784645312512057150L;
	protected transient PropertyChangeSupport listeners = new PropertyChangeSupport(
			this);

	protected PropertyAwareObject() {
	}

	public void addPropertyChangeListener(PropertyChangeListener l) {
		listeners.addPropertyChangeListener(l);
	}

	public void removePropertyChangeListener(PropertyChangeListener l) {
		listeners.removePropertyChangeListener(l);
	}

	public void firePropertyChange(int prop, Object old, Object newValue) {
		listeners.firePropertyChange(String.valueOf(prop), old, newValue);
	}
	
	public void firePropertyChange(String prop, Object old, Object newValue) {
		listeners.firePropertyChange(prop, old, newValue);
	}

}
